//
//  ZYFWTableViewCell.m
//  WisdomCommunity
//
//  Created by Yahaong on 16/8/8.
//  Copyright © 2016年 zonten. All rights reserved.
//

#import "ZYFWTableViewCell.h"
#import "YHMarcros.h"
@interface ZYFWTableViewCell ()
@property(nonatomic, strong)UIImageView *iconView;
@property(nonatomic, strong)UILabel *topicLabel;
@property(nonatomic, strong)UIButton *timeButton;
@property(nonatomic, strong)UIButton *countButton;
@end
@implementation ZYFWTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}
- (void)awakeFromNib {
    [super awakeFromNib];

}

- (void)setupUI
{
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    [self.contentView addSubview:self.iconView];
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.leading.equalTo(self.contentView).offset(8);
        make.size.equalTo(CGSizeMake(45, 45));
    }];
    
    [self.contentView addSubview:self.topicLabel];
    [self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.iconView);
        make.leading.equalTo(self.iconView.trailing).offset(8);
    }];
    [self.contentView addSubview:self.timeButton];
    [self.timeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topicLabel.bottom).offset(8);
        make.leading.equalTo(self.topicLabel);
        
    }];
    [self.contentView addSubview:self.countButton];
    [self.countButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.timeButton);
        make.leading.equalTo(self.timeButton.trailing).offset(8);
    }];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setImageStr:(NSString *)imageStr
{
    _imageStr = [imageStr copy];
    self.iconView.image = [UIImage imageNamed:imageStr];
}
#pragma  mark <懒加载>

- (UIImageView *)iconView
{
    if (!_iconView) {
        _iconView = [[UIImageView alloc]init];
        _iconView.image = [UIImage imageNamed:@"22志愿服务_"];
    }
    return _iconView;
}

- (UILabel *)topicLabel
{
    if (!_topicLabel) {
        _topicLabel = [[UILabel alloc]init];
        _topicLabel.text = @"温暖重阳 关爱老人";
    }
    return _topicLabel;
}
- (UIButton *)timeButton
{
    if (!_timeButton) {
        _timeButton = [[UIButton alloc]init];
        [_timeButton setImage:[UIImage imageNamed:@"22志愿服务3_"] forState:UIControlStateNormal
         ];
        [_timeButton setTitle:@"2016/7/30 09:30" forState:UIControlStateNormal];
        [_timeButton setTitleColor:RGBColor(163, 163, 163) forState:UIControlStateNormal];
        _timeButton.titleLabel.font = [UIFont systemFontOfSize:14];
    }
    return _timeButton;
}
- (UIButton *)countButton
{
    if (!_countButton) {
        _countButton = [[UIButton alloc]init];
        [_countButton setImage:[UIImage imageNamed:@"22志愿服务4_"] forState:UIControlStateNormal
         ];
        [_countButton setTitle:@"30人" forState:UIControlStateNormal];
        [_countButton setTitleColor:RGBColor(163, 163, 163) forState:UIControlStateNormal];
        _countButton.titleLabel.font = [UIFont systemFontOfSize:14];
    }
    return _countButton;
}
@end
